Skip to content

Conversation

@adrianclay
Copy link
Contributor

Why

v1 stops getting updates as of Dec 2025

Type of change

Internal change (non-breaking change with no effect on the functionality affecting end users)

Checklist:

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the Changelog with details of my change in the UNRELEASED section if this change will affect end users

v1 stops getting updates as of Dec 2025
@NHSDigital NHSDigital deleted a comment from github-actions bot Sep 2, 2024
@ORybak5 ORybak5 marked this pull request as ready for review January 10, 2025 10:19
void expectToReturnS3ClientTest() {
var s3Client = configuration.getS3Client();

assertNotNull(s3Client);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha. Hmm. Assert Not Null isn't the greatest test.

@ConfigurationProperties(prefix = "gp2gp.storage")
public class StorageConnectorConfiguration {

private static final Region REGION = Region.EU_WEST_2;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dodgy.

Comment on lines +59 to +61
Field s3ClientField = CustomTrustStore.class.getDeclaredField("s3Client");
s3ClientField.setAccessible(true);
s3ClientField.set(customTrustStore, s3Client);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally not a fan of messing around with reflection to create tests. Any way to make the s3Client a constructor argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, I'd probably make the AppInitializer construct it's own CustomTrustStore instead of relying on dependency injection. Also moving into AppInitializer the logic to optionally construct the S3Client that is currently inside of StorageConnectorConfiguration.

AppInitializer can instead depend on StorageConnectorConfiguration.

@ORybak5 ORybak5 enabled auto-merge (squash) January 10, 2025 14:27
this.s3client = AmazonS3ClientBuilder
.standard()
.build();
this.s3client = s3client;
Copy link
Contributor Author

@adrianclay adrianclay Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this use the Bean defined as getS3Client inside of StorageConnectorConfiguration.java ? Because if so, then that bean only gets constructed when a truststore is defined. Whereas previously this was being constructed all the time.

It will come from the StorageConnectorFactory which is fine.

./gradlew test jacocoTestReport -x integrationTest --parallel --build-cache
else
./gradlew test jacocoTestReport sonar --parallel --build-cache
./gradlew test jacocoTestReport sonar -x integrationTest --parallel --build-cache
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this stuff into a separate PR.

}

check.dependsOn integrationTest
jacocoTestReport.dependsOn integrationTest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not what's causing the integration tests to run as part of the unit tests?

@github-actions
Copy link

  • Surviving mutants in this change: 3
  • Killed mutants in this change: 7
class surviving killed
🧟uk.nhs.adaptors.gp2gp.common.storage.StorageConnectorConfiguration 1 0
🧟uk.nhs.adaptors.gp2gp.common.configuration.CustomTrustStore 1 2
🧟uk.nhs.adaptors.gp2gp.common.storage.StorageConnectorFactory 1 0
💯uk.nhs.adaptors.gp2gp.common.storage.S3StorageConnector 0 5

See https://pitest.org

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
71.4% Coverage on New Code (required ≥ 80%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ORybak5 ORybak5 merged commit b3cef76 into main Jan 10, 2025
10 of 11 checks passed
@ORybak5 ORybak5 deleted the upgrade-amazon-sdk branch January 10, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants